import request from '@/utils/request'
import { getRealToken } from '@/utils/util'
// 校验用户token
export function userInfo() {
  return request({
    url: '/smartportal/userInfo/userT',
    method: 'get'
  })
}

// 获取当前登录人组织机构
export function findOrgMappedBylogin() {
  return request({
    url: '/smartportal/OrgMapped/findOrgMappedBylogin',
    method: 'get'
  })
}
// 大屏token
export function getSsoToken(params) {
  return request({
    url: '/smartportal/FineReport/getSsoToken',
    method: 'get',
    params: params
  })
}
// 获取组织角色
export function getDetailByAccountOrId(params) {
  return request({
    url:
      process.env.NODE_ENV === 'production'
        ? '/eip-uc/api/user/v1/user/getDetailByAccountOrId'
        : '/api/user/v1/user/getDetailByAccountOrId',
    method: 'get',
    params: params,
    headers: {
      Authorization: 'Bearer ' + getRealToken()?.insightToken
    }
  })
}
export function getSelf() {
  return request({
    url:
      process.env.NODE_ENV === 'production'
        ? '/jjyxapi/iam/hzero/v1/users/self'
        : '/iam/hzero/v1/users/self',
    method: 'get',
    headers: {
      Authorization: 'Bearer ' + getRealToken()?.insightToken
    }
  })
}
export function getUserInfo(id) {
  return request({
    url:
      process.env.NODE_ENV === 'production'
        ? `/jjyxapi/jjyx-org/v1/${id}/jjyx/user/getUserInfo`
        : `/jjyx-org/v1/${id}/jjyx/user/getUserInfo`,
    method: 'get',
    headers: {
      Authorization: 'Bearer ' + getRealToken()?.insightToken
    }
  })
}
